////////////////////////////////////////////////////////////////////////////////
//
//  FLYING KIWI BV
//  Copyright 2010 Flying Kiwi BV
//  All Rights Reserved.
//
//  NOTICE: Flying Kiwi permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package plantool.modules.workplaces.display {
	//--------------------------------------------------------------------------
	//  Imports
	//--------------------------------------------------------------------------
	import flash.display.GradientType;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	
	import kiwi.components.ComponentSkin;
	import kiwi.components.skins.IButtonSkin;
	
	
	//--------------------------------------------------------------------------
	//  [Metadata (Events, Style, Effects etc)]
	//--------------------------------------------------------------------------
	
	//--------------------------------------------------------------------------
	//  Class declaration
	//--------------------------------------------------------------------------
	public class WorkplaceUserHourSkin extends ComponentSkin implements IButtonSkin {
		//--------------------------------------------------------------------------
		//Class constants
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//Class variables
		//--------------------------------------------------------------------------
		private var _color:uint			= 0;
		private var _width:Number		= 0;
		private var _height:Number		= 0;
		
		//--------------------------------------------------------------------------
		//Class properties
		//--------------------------------------------------------------------------
		public function set color(value:uint):void 				{ _color = value; invalidate(); }
		public function get color():uint						{ return _color; }
		override public function get height():Number 			{ return _height; }
		override public function set height(value:Number):void 	{ _height = value; invalidate(); }
		override public function get width():Number 			{ return _width; }
		override public function set width(value:Number):void 	{ _width = value; invalidate(); }
		
		//--------------------------------------------------------------------------
		//Constructor and Destructor
		//--------------------------------------------------------------------------
		public function WorkplaceUserHourSkin()
		{
		}
		
		//--------------------------------------------------------------------------
		//Class methods
		//--------------------------------------------------------------------------
		public function mouseHandler(event:MouseEvent):void {
		}
		
		protected override function update():void {
			//create button graphics
			graphics.clear();
			graphics.beginFill(color);
			graphics.drawRect(0, 0, width, height);
			graphics.endFill();
			
			var myMatrix:Matrix = new Matrix();
			myMatrix.createGradientBox(width, height, Math.PI / 4, 0, 0);
			var colors:Array = [0xFFFFFF, 0xFFFFFF];
			colors = [0xFFFFFF, 0xFFFFFF];
			var alphas:Array = [0.2, 0.4];
			var ratios:Array = [0, 255];
			
			graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, myMatrix);
			graphics.drawRect(0, 0, width, height);
			graphics.endFill();
		}
	}
}